/**
**************************************************************************************
*Founder Effect                                                                      *
*Copyright (C) 2006-2007, 5d Studios (www.5d-Studios.com)                            *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library is distributed in the hope that it will be useful,                     *
*but WITHOUT ANY WARRANTY; without even the implied warranty of                      *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
#pragma once
#include <string>

#include "../shared/geom.h"
#include "../Commands.h"
#include "IGeom.h"
#include "GeomImporter.h"



/**
==========================================================
Map Change command
==========================================================
*/
class SceneManager;//InGameStateView;
class MapChange_f : public ICommand
{
public:
    MapChange_f() { sceneMng = NULL; };
    void Set( SceneManager* s ) { sceneMng= s; };
    void Exec(std::string &s);
    ~MapChange_f() {};
    SceneManager* sceneMng;

};

/**
===========================
Loads a Scene (a map) and based off of the 
current camera, draws the map
===========================
*/
class SceneManager
{
public:
    SceneManager(void); 
	/** Load a map */
    bool    LoadMap( const std::string &file );
    /** Unload the map */
	void    UnloadMap();

	/** Update the current scene */
    void Update(long dt);
	/** Draw the current Scene */
    void Render(IRender* r, ICamera* cam);

    /** Get the current scene */
    IGeom* GetCurrentMap() { return m_currentMap; };

private:
	// the current scene to display
    IGeom*           m_currentMap;

    // Imports Maps--duh!
    GeomImporter     m_mapImporter;

    // we should load next update
    bool           m_loadingMap;
    // if a map was loaded
    bool            m_mapLoaded;

    // Console Function
    MapChange_f     m_mapChange;

public:
    virtual ~SceneManager(void);
};
